package org.flashIso.engine.library.objects
{
	import org.flashIso.engine.core.ILibrary;

	public class LTile extends LObjectBase
	{
		private var _elevationNorth : uint = 0;
		private var _elevationSouth : uint = 0;
		private var _elevationEast : uint = 0;
		private var _elevationWest : uint = 0;
		
		public function LTile(){
			_deltaX = -50;
			_deltaY = -50;
			_deltaZ = 0;
			_zSize = 0;
		}
		
		public function get elevationNorth() : uint {
			return _elevationNorth;
		}
		public function set elevationNorth(value : uint) : void {
			if (_elevationNorth != value){
				_elevationNorth = value;
				triggerValidation();
			}
		}
		
		public function get elevationSouth() : uint {
			return _elevationSouth;
		}
		public function set elevationSouth(value : uint) : void {
			if(_elevationSouth != value){
				_elevationSouth = value;
				triggerValidation();
			}
		}
		
		public function get elevationEast() : uint {
			return _elevationEast;
		}
		public function set elevationEast(value : uint) : void {
			if(_elevationEast != value){
				_elevationEast = value;
				triggerValidation();
			}
		}
		
		public function get elevationWest() : uint {
			return _elevationWest;
		}
		public function set elevationWest(value : uint) : void {
			if(_elevationWest != value){
				_elevationWest = value;
				triggerValidation();
			}
		}
		
		override public function toXML() : XML {
			var xml:XML = super.toXML();
			
			xml.@elevationNorth = elevationNorth;
			xml.@elevationSouth = elevationSouth;
			xml.@elevationEast = elevationEast;
			xml.@elevationWest = elevationWest;
			
			return xml;
		}
		override public function fromXML(xml:XML, library:ILibrary = null) : void {
			super.fromXML(xml, library);
			elevationNorth = parseFloat(xml.@elevationNorth);
			elevationSouth = parseFloat(xml.@elevationSouth);
			elevationEast = parseFloat(xml.@elevationEast);
			elevationWest = parseFloat(xml.@elevationWest);
		}
	}
}